package custom.security.web.filter;

import lombok.extern.slf4j.Slf4j;

import javax.servlet.*;
import java.io.IOException;

/**自定义拦截器
 * Created by security on 2017/9/24.
 */
@Slf4j
public class TimeFilter implements Filter {
    @Override
    public void init(FilterConfig filterConfig) throws ServletException {
        log.info("time filter init success !");
    }

    @Override
    public void doFilter(ServletRequest request, ServletResponse response, FilterChain filterChain) throws IOException, ServletException {

        log.info("filter start work .");
        log.info("action before:"+System.currentTimeMillis()+"");
        filterChain.doFilter(request,response);
        log.info("action after:"+System.currentTimeMillis()+"");
    }

    @Override
    public void destroy() {
        log.info("time filter destroy success !");
    }
}
